Object.prototype[Symbol.iterator] = function() {
    let data = this;
    let keys = Object.keys(data);
    return {
        step: 0,
        next: function() {
            let result = { value: undefined, done: true };
            if(this.step < keys.length) {
                result = { value: data[keys[this.step]], done: false };
            }
            this.step++;
            return result;
        }
    };
}
let obj = {x: 1, y: 2};
for(var r of obj) {
    console.log(r);
}

